package member.model;

import java.sql.SQLException;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;

public class MemberDao {
	private SqlMapClient sqlMapClient;
	private MemberDao(SqlMapClient sqlMapClient){
		this.sqlMapClient=sqlMapClient;
	}
	public void memberRegist(MemberVO memberVO) throws SQLException {
		sqlMapClient.insert("member.memberRegist",memberVO);
	}
	public int memberExistId(String id) throws SQLException {
		return (int) sqlMapClient.queryForObject("member.memberExistId",id);
	}
	public MemberVO memberLogin(MemberVO memberVO) throws SQLException {
		return (MemberVO) sqlMapClient.queryForObject("member.memberLogin",memberVO);
	}
	public MemberVO memberUpdate(MemberVO memberVO) throws SQLException {
		sqlMapClient.update("member.memberUpdate",memberVO);
		return (MemberVO) sqlMapClient.queryForObject("member.memberLogin",memberVO);
	}
	public void memberDelete(String id) throws SQLException {
		sqlMapClient.delete("member.memberDelete",id);
	}
	public List memberGetAllMember() throws SQLException{
		return sqlMapClient.queryForList("member.memberGetAllMember");
	}
	public MemberVO getMatchedVO(String id) throws SQLException {
		return (MemberVO) sqlMapClient.queryForObject("member.getMatchedVO",id);
	}
}
